---
title: "SQL-002: Get agency"
summary: Retrieve the agency row for a policy.
status: draft
owner: SAIF Corporation
last_reviewed: 2026-08-21
library: SAIF.Business.View.Policy
reference_type: embedded
---

# SQL-002 Get agency

Retrieve the agency row for a policy.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-002 |
| **Operation type** | Read |
| **Execution method** | Stored procedure |
| **Database** | Oracle |
| **Schema** | `[unqualified]**` |
| **Command type** | StoredProcedure |
| **Business object** | `clsAgency` |
| **Criteria property** | `RetrieveSQL` |
| **Lifecycle method** | `BeforeRetrieve` / `AfterRetrieve` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:apolicynum` | Input | Decimal | N/A | Policy number |
| `recordset` | Output (Cursor) | REF CURSOR | N/A | Agency row |

## Tables

N/A — Stored procedure

## Sample SQL

```sql
-- Oracle stored procedure call (CommandType.StoredProcedure)
-- clsAgency.BeforeRetrieve
CALL pk72846_view_policy.getAgency(
  :apolicynum,
  :recordset)
```


## Operations and processes
- [Retrieve policy data](../operations-processes.md)

## Business rules
- [BR-VP-010: Demo users see masked data](../business-rules.md#br-vp-010-demo-users-see-masked-data)
- [BR-VP-025: Missing agency row records a "No data found" error](../business-rules.md#br-vp-025-missing-agency-row-records-a-no-data-found-error)
- [BR-VP-027: Create/Insert/Update/Delete SQL are invalid](../business-rules.md#br-vp-027-createinsertupdatedelete-sql-are-invalid)

## Sources
- `SAIF.Business.View.Policy/clsAgency.vb`
